#! /usr/bin/env node

const plugin = require("./plugin")
const questions = require("./ev/questions")
const spawn = require("child_process").spawn
const Utils = require("./ev/utils")
const utils = new Utils()

let prompt = async () => {
  let ans = await plugin.inquirer.prompt(questions)
  let clone = spawn("git", ['clone', 'https://gitee.com/fuyoo/fy-tpl.git', ans.name])
  clone.stdout.on("data",utils.log.bind(utils))
  clone.stderr.on("data",utils.log.bind(utils))
  clone.on("err",utils.log.bind(utils))
  clone.on('close', await utils.exit(ans))
}

prompt()
